package com.balloon.springboot.logger.entity;

import com.balloon.springboot.orm.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;


/**
 * 持久化存储日志信息 Entity
 *
 * @author liaofuxing
 * @date 2021/09/01 10:43
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Table
@Entity
public class LoggerInfo extends BaseEntity {

    /**
     * 日志id UUID
     */
    @Id
    private String id;

    /**
     * 操作日志用户ID
     */
    private String userId;

    /**
     * 操作日志用户名
     */
    private String username;

    /**
     * 操作日志用户IP
     */
    private String ip;

    /**
     * 操作日志用户操作系统
     */
    private String os;

    /**
     * 请求URL
     */
    private String requestURL;

    /**
     * 请求参数
     */
    private String requestParameter;

    /**
     * get or post
     */
    private String method;

    /**
     * 浏览器类型
     */
    private String browser;

    /**
     * 浏览器版本
     */
    private String browserVersion;

    /**
     * 请求开始时间
     */
    private String requestStartTime;

    /**
     * 请求结束时间
     */
    private String requestEndTime;

    /**
     * 请求消耗多少毫秒
     */
    private String consumeTime;

    /**
     * 请求返回值
     */
    private String resultVal;

    /**
     * 是否成功 success, 失败 fail
     */
    private String requestState;

    public LoggerInfo() {
    }

    public LoggerInfo(String id, String userId, String username, String ip, String os, String requestURL, String requestParameter, String method, String browser, String browserVersion) {
        this.id = id;
        this.userId = userId;
        this.username = username;
        this.ip = ip;
        this.os = os;
        this.requestURL = requestURL;
        this.requestParameter = requestParameter;
        this.method = method;
        this.browser = browser;
        this.browserVersion = browserVersion;
    }


}
